import { getStorage,setStorage } from '@/utils/tools'
import { defineStore } from 'pinia'
import { RouteRecordRaw } from 'vue-router'
export const menusStore = defineStore({
  id: 'app-menus',
  state:()=>{
    return {
      menus:  getStorage('menus'),
      permissionAction:  getStorage('permission_action'),
      curNav: 0,
      isMenu: false,
    }
  },
  actions: {
    setMenus(value: any) {
      setStorage('menus',value);
      this.menus = value
    },
    setPermissionAction(value: any) {
      setStorage('permission_action',value);
      this.permissionAction = value
    },
    setCurNav(value: any) {
      this.curNav = value
    },
    setIsMenu(value: any) {
      this.isMenu = value
    },
    initMenus(value: any) {
      setStorage('menus',value);
      this.menus = value
    },
  },
  getters: {
    getMenus(): any {
      return this.menus
    },
    getIsMenu(): any {
      return this.isMenu
    },
    getCurNav(): any {
      return this.curNav
    },
    getPermissionAction(): any {
      return this.permissionAction
    }
  },
})
